<template>
    <div>
        <textarea v-model="noteText" id="" cols="50" rows="10"></textarea>
        <button @click="saveNote">保存</button>
    </div>
</template>
<script>
import {ref,onMounted} from 'vue'
const noteText = ref('')
onMounted(()=>{
    const storedText= localStorage.getItem('note')
    if(storedText){
        noteText.value = storedText
    }
})
const saveNote = ()=>{
    localStorage.setItem('note',noteText.value)
}
</script>